{extend name='main'}

{block name="button"}
<!--{if auth("clear")}-->
<button data-load='{:url("clear")}' data-confirm="确定要清理所有记录吗？" class='layui-btn layui-btn-sm layui-btn-primary'>清理所有日志</button>
<!--{/if}-->

<!--{if auth("remove")}-->
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" data-confirm="确定要删除这些记录吗？" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除日志</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="think-box-shadow table-block">
    {include file='oplog/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
            </th>
            <th class='text-left nowrap'>操作权限</th>
            <th class='text-left nowrap'>操作行为</th>
            <th class='text-left nowrap'>地理位置</th>
            <th class='text-left nowrap'>操作时间</th>
            <th></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
            </td>
            <td class="text-left nowrap">
                操作账号：<span class="font-w7">{$vo.username|default='-'}</span><br>
                操作节点：<span class="color-desc">{$vo.node|default='-'}</span>
            </td>
            <td class='text-left nowrap padding-row-0 padding-right-0'>
                <p class="color-text layui-elip">{$vo.action|default='-'}</p>
                <span class="color-desc">{$vo.content|default='-'}</span>
            </td>
            <td class='text-left nowrap'>
                <p class="color-text">{$vo.geoip|default='-'}</p>
                <p class="color-desc">{$vo.isp|default='-'}</p>
            </td>
            <td class='text-left nowrap'>
                日期：{$vo.create_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span>
            </td>
            <td class='text-left nowrap'>
                <!--{if auth("remove")}-->
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该日志吗？" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                <!--{/if}-->
            </td>
        </tr>
        {/foreach}
        </tbody>
        {/notempty}
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}

{block name='script'}
<script>
    (function (layers) {
        $('body').off('click', '[data-tips-desc]').on('click', '[data-tips-desc]', function () {
            return layers.push(layer.tips($(this).find('textarea').html(), this, {tips: 3, time: 0, maxWidth: 500})), false;
        }).off('click', '.layui-body').on('click', '.layui-body', function () {
            layers.forEach(function (value, index) {
                layer.close(value), delete layers[index];
            });
        });
        $(window).on('hashchange', function () {
            layers.forEach(function (value, index) {
                layer.close(value), delete layers[index];
            });
        });
    })([]);
</script>
{/block}
